#!/usr/bin/env python
#encoding:utf-8

import redis

if __name__ == '__main__':
    r = redis.Redis(host='127.0.0.1', db=1)
    for rn in r.keys('mdm_item*'):
        keys = r.hkeys(rn)
        keys.sort()
        v = r.hget(rn, keys[-1])
        if v.find('ipaddr') >= 0:
            print rn

